var http = require('http');
var server = http.createServer();

//为request事件添加匿名监听函数
server.on('request', function(req, res) {
    // 写入http响应头
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    //写入http响应体
    res.write('shiyanlou');
    console.log('shiyanlou');
    // 响应结束
    res.end();
});
// 本地监听该端口请求
server.listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337');